import { connect } from 'react-redux'

import { actions } from 'react-native-navigation-redux-helpers'

import Login from '../components/login'

const {
  replaceAt,
} = actions

const mapStateToProps = (state) => ({
  navigation: state.cardNavigation
})

const bindAction = (dispatch) => ({
  onLoginPress: (navigation) => {
    const route = { key: 'home' }
    dispatch(replaceAt('login', route, navigation.key))
  },
})

export default connect(mapStateToProps, bindAction)(Login)
